Skip to content

feat(server): support build & use(RocksDB) on RISC-V - #3102

Merged
imbajin merged 10 commits into
apache:masterfrom
Seanium:feature/riscv64-rocksdb-support
Jul 25, 2026
Merged

feat(server): support build & use(RocksDB) on RISC-V#3102
imbajin merged 10 commits into
apache:masterfrom
Seanium:feature/riscv64-rocksdb-support

Conversation

@Seanium

@Seanium Seanium commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Purpose of the PR

  • Address the HugeGraph Server + RocksDB linux/riscv64 build and minimum runtime
    support tracked by [Task] Support HugeGraph with RocksDB on RISC-V #3099.
  • Keep the change isolated from the existing Docker image design and from the JDK,
    build, and test paths used by other architectures.

Main Changes

  • Add an opt-in -Drocksdb-only distribution selection. CI uses Maven's existing
    -pl ... -am project selection so unrelated storage implementations are not built or
    packaged; the default reactor and distribution remain unchanged.
  • Upgrade Maven architecture detection and use compatible system protoc and
    grpc_java_plugin executables only in the automatically activated RISC-V profiles.
  • Automatically preload an installed libatomic.so.1 before the Server, InitStore, or
    StoreDumper JVM opens RocksDB on linux/riscv64, fixing the unresolved JNI atomic
    symbol in each distribution launcher.
  • Add reusable JNI and Server smoke helpers covering RocksDB put/get/reopen, REST schema
    and graph data, Gremlin, shutdown, a real store dump, restart, and persistence.
  • Add an isolated reusable RISC-V workflow, invoked as a separate Server CI job. It runs
    a clean native RISC-V Maven build and the runtime smoke under QEMU with a
    checksum-pinned Alibaba Dragonwell 11 Extended Server VM.
  • Document the supported ABI, native build commands, CI/QEMU boundary, and the fact that
    the official HugeGraph Dockerfile and published image are not changed by this PR.

Scope Boundaries

  • No official Dockerfile, entrypoint, Docker Build CI, or image publication changes.
  • No JDK or test changes for amd64, arm64, or other existing architectures.
  • No RISC-V support claim for HBase, Cassandra, HStore, PD, Store, or other backends.
  • QEMU is a correctness gate, not a performance result.

Validation

  • Default Java 11 build: 43/43 reactor modules passed; the existing backend JARs
    remained in the normal distribution.
  • Exact-head native RISC-V clean RocksDB-only build passed all 16 selected projects
    from clean source; protobuf and gRPC Java sources were regenerated with the documented
    system tools.
  • Exact-head native RISC-V runtime on Dragonwell 11 Server VM passed RocksDB JNI
    put/get/reopen, REST schema/vertices/edge, Gremlin, both shutdowns, the no-argument
    dump-store.sh path with both current-run vertices, restart persistence, and final
    process/port cleanup.
  • During implementation, the broader native RISC-V Core suite passed 794 tests with
    0 failures and 0 errors (41 skipped), and the API suite passed 161 tests with
    0 failures and 0 errors (14 skipped) with a valid JaCoCo XML report. These suites are
    supporting evidence, not represented as exact-head hosted CI.
  • Workflow YAML, ShellCheck, Bash syntax, XML/RAT, default-profile regression,
    distribution-boundary, and git diff --check validation passed.
  • Current-head org Server CI
    30093815746 passed,
    including the native RISC-V clean build, distribution boundary, JNI, REST/Gremlin,
    restart persistence, shutdown, and container cleanup
    job.
  • Current-head org
    PD/Store/HStore CI
    passed.
  • Current-head Apache workflows are awaiting maintainer approval; no exact-head check
    runs are registered yet.

Compatibility

  • Existing Server CI still runs its original memory, RocksDB, HBase, and two macOS Java
    11 jobs unchanged; the RISC-V workflow is an additional isolated job.
  • The default Maven invocation still activates the existing memory and core-test
    profiles and retains the complete module set.
  • The RISC-V path requires 64-bit glibc Linux (LP64D), Dragonwell 11 Extended, and an
    installed libatomic.so.1.

Residual Risks

  • Native end-to-end validation used Ubuntu 24.04 with glibc 2.39. GLIBC_2.30 is
    only the highest symbol version referenced by the packaged rocksdbjni:8.10.2 RISC-V
    ELF, not a validated compatibility floor for the complete runtime.
  • QEMU and the available native machine validate correctness, not sustained production
    load or performance.
  • Official multi-architecture image design and publication remain separate work.

@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. ci-cd Build or deploy feature New feature store Store module labels Jul 21, 2026
@Seanium
Seanium force-pushed the feature/riscv64-rocksdb-support branch from b5da4f4 to 25a16ff Compare July 21, 2026 13:59
@Seanium
Seanium force-pushed the feature/riscv64-rocksdb-support branch from 25a16ff to b9d9d8c Compare July 21, 2026 15:00

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: yes. Summary: The new multi-architecture gate cannot start under the repository policy, and the native/runtime validation paths retain correctness and liveness gaps. Evidence: exact-head workflow run 29841863669 ended startup_failure with zero jobs; static inspection of the changed workflow, test, and smoke scripts.

Comment thread .github/workflows/docker-build-ci.yml Outdated
Comment thread .github/workflows/docker-build-ci.yml Outdated
Comment thread hugegraph-server/hugegraph-dist/src/assembly/travis/run-rocksdb-jni-smoke-test.sh Outdated
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 32.73%. Comparing base (89b648a) to head (87ec351).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3102      +/-   ##
============================================
- Coverage     37.43%   32.73%   -4.70%     
+ Complexity      520      498      -22     
============================================
  Files           808      819      +11     
  Lines         69581    70745    +1164     
  Branches       9165     9366     +201     
============================================
- Hits          26048    23160    -2888     
- Misses        40750    45016    +4266     
+ Partials       2783     2569     -214     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: no. Summary: The current head fixes the earlier RISC-V validation gaps and all visible checks pass, but the new cleanup path cannot detect a timed-out server shutdown. Evidence: exact-head shell control-flow inspection and Bash exit-status reproduction.

trap - EXIT

if [[ "$SERVER_START_ATTEMPTED" == "true" ]]; then
if ! "$TRAVIS_DIR"/stop-server.sh "$SERVER_DIR"; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Important: propagate shutdown failures into this cleanup check

This check cannot currently detect a shutdown timeout. stop-server.sh delegates to stop-hugegraph.sh, whose last command is an if kill_process_and_wait ...; then rm ...; fi; when that condition is false, Bash returns status 0 for the if because there is no else. The cleanup can therefore report success while the server and stale PID file remain. Please make stop-hugegraph.sh explicitly return nonzero when kill_process_and_wait fails, and remove the PID file only on success, so this new EXIT cleanup can enforce the result it checks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3e6f4d8d. stop-hugegraph.sh now exits 1 when kill_process_and_wait fails and removes the PID file only after a successful shutdown, so stop-server.sh and the EXIT cleanup receive the real status. A real timeout check with a SIGTERM-ignoring process returned 1 and retained the PID file; the normal path returned 0, stopped the process, and removed the PID file. On the current head, Linux RocksDB/memory API jobs, both macOS jobs, and the full runtime matrix have passed in org CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on the exact current head bd69efb: the org RISC-V job initially failed precisely because stop-hugegraph.sh propagated the 10-second shutdown failure. Logs showed the Java shutdown hooks completed but the sleep-as-PID-1 container retained the exited daemon as a zombie. The CI container now uses Docker --init to reap it; the product timeout and failure propagation remain unchanged. Exact-head jobs 89152468612 and 89155333088 both then passed both shutdowns and cleanup. This confirms the failure is not swallowed.

@Seanium

Seanium commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

All six review findings have now been addressed in 5972a6f5 and 3e6f4d8d, with detailed replies on each thread.

Current-head validation in hugegraph/hugegraph PR #164 has passed the RISC-V QEMU runtime and native Maven gate, amd64/arm64 runtime, Linux RocksDB/memory, both macOS RocksDB jobs, PD/Store/HStore, CodeQL, licensing, dependency, and Docker checks. Cluster passed on the repository's automatic second attempt. HBase is still in its pre-existing backend environment preparation step, so I am not reporting it as passed yet.

The seven Apache workflows for head 3e6f4d8d are currently action_required and need maintainer approval. Please re-review the fixes and approve the new-head workflow run when convenient.

@Seanium

Seanium commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Update: current-head validation in hugegraph/hugegraph#164 is now complete. All 24 checks passed, including HBase compile/unit/core/API, the RISC-V QEMU runtime and native Maven gate, amd64/arm64 runtime, Linux RocksDB/memory, both macOS jobs, PD/Store/HStore, and Cluster after the repository's automatic retry.

The Apache workflows for the same head remain action_required; no Apache new-head result is being claimed yet.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: yes. Summary: The RISC-V path is substantially improved, but the default Maven invocation now silently drops the existing Core test and memory-backend profiles; the architecture smoke trigger also misses RocksDB source-only changes. Evidence: exact-head Maven active-profile output, workflow path inspection, shell syntax checks, and rocksdb-only reactor validation.

Comment thread hugegraph-server/pom.xml Outdated
<id>all-backends</id>
<activation>
<property>
<name>!rocksdb-only</name>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‼️ Critical: preserve the existing default test profiles

This property-activated all-backends profile is active whenever rocksdb-only is absent. Maven deactivates an activeByDefault profile when another profile in the same POM activates, so the normal invocation no longer activates core-test; the analogous new profile in hugegraph-test/pom.xml also disables the default memory profile. On this exact head, mvn help:active-profiles -pl hugegraph-server/hugegraph-test lists both all-backends profiles but neither core-test nor memory, while -Drocksdb-only restores them. Ordinary default builds can therefore skip the established Core Surefire execution and lose the filtered memory backend configuration. Please restructure the full-backend selection so default builds retain core-test and memory, and add a regression check for the default active-profile/test set.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed on the current head. The new profiles in hugegraph-server/pom.xml and hugegraph-test/pom.xml were removed, so the existing activeByDefault core-test and memory profiles are no longer displaced. The default invocation was rechecked with Maven and still activates memory, core-test, and the complete module set; current-head org memory, RocksDB, and both macOS Server jobs have also passed.

Comment thread .github/workflows/docker-build-ci.yml Outdated
- 'hugegraph-pd/hg-pd-grpc/pom.xml'
- 'hugegraph-server/pom.xml'
- 'hugegraph-server/hugegraph-core/pom.xml'
- 'hugegraph-server/hugegraph-rocksdb/pom.xml'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Important: run the architecture smoke for RocksDB source changes

The new runtime matrix builds and executes the RocksDB/JNI module, but this path filter matches only its pom.xml. A PR that changes hugegraph-server/hugegraph-rocksdb/src/** without touching one of the listed infrastructure files will not schedule the amd64/arm64/riscv64 smoke, leaving native-loading and architecture regressions untested. Please cover the module path (for example, hugegraph-server/hugegraph-rocksdb/**) or otherwise add an equivalent trigger for the runtime code exercised by this job.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the maintainer-requested scope reduction. The Docker runtime matrix and its path filter were removed. RISC-V validation now runs as an independent reusable job invoked from the existing server-ci.yml, so every Server CI pull_request event, including hugegraph-rocksdb source-only changes, schedules the RISC-V build and runtime gate. Exact-head org job 89155333088 passed the clean build, JNI, REST/Gremlin, restart persistence, shutdown, and cleanup flow.

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Jul 23, 2026
Restore the existing Docker and default test paths unchanged. Run the native RocksDB-only build and runtime smoke in a dedicated QEMU job.
@Seanium

Seanium commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Current head 1c30c1c5 keeps the root/default reactor, existing Dockerfiles, JDKs,
tests, and Server jobs unchanged. The opt-in rocksdb-only behavior is limited to the
distribution dependency and backend-registry selection.

Current-head native validation:

  • native RISC-V passed the clean 16-project build, system protobuf generation,
    RocksDB-only distribution boundary, Dragonwell 11 Server VM, libatomic, JNI
    put/get/reopen, REST/Gremlin, both shutdowns, the no-argument dump-store.sh path
    with both current-run vertices, restart persistence, and cleanup;
  • the previous-head org QEMU job
    89169639441
    passed in 23m17s and is retained as implementation evidence, not claimed for the new
    head;
  • the unchanged Linux memory/RocksDB, Intel macOS, HBase compile/unit/core/API,
    PD/Store/HStore, Commons, CodeQL, license, and dependency checks passed on the
    previous head.

Two org checks expose existing failures outside this PR's diff:

  • Cluster failed both attempts at MultiClusterDeployTest:61 with
    Connection refused; the latest two master runs fail at the same test, line, and
    error.
  • Apple Silicon macOS failed both attempts only at
    TaskCoreTest.testEphemeralJob:608. This PR has no diff in that test, the task
    scheduler, or the macOS job; the same source passed the latest master job and two
    preceding branch-head jobs. The failures are retained and were not filtered or
    repeatedly rerun.

The six Apache workflow suites for exact head 1c30c1c5 are action_required with
zero jobs. Please approve those workflows when convenient; no org result is represented
as an Apache result.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: yes. Summary: The main RISC-V server path is covered, but the distribution's store-dump JVM still opens RocksDB without the required libatomic preload. Evidence: exact-head call-site inspection of util.sh, dump-store.sh, and StoreDumper.java; bash/action workflow static validation.

fi
}

function configure_riscv64_libatomic() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Important: apply the RISC-V libatomic setup to the store dumper

This helper is invoked by hugegraph-server.sh and init-store.sh, but dump-store.sh still launches StoreDumper directly without sourcing util.sh. StoreDumper constructs the graph with HugeFactory.open(conf), so a RocksDB-backed dump on RISC-V starts a separate JVM without the LD_PRELOAD required by this change and can fail at native library loading even though server startup succeeds. Please invoke this helper before the dumper JVM (and audit any other standalone RocksDB-opening launchers), then cover the store-dump path in the native RISC-V smoke test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1c30c1c5.

dump-store.sh now sources util.sh and configures libatomic before starting its
independent JVM. The launcher also had two pre-existing blockers that prevented a real
smoke test: its classpath variable was passed as a literal, and its default graph config
pointed to the removed conf/hugegraph.properties path. Both are corrected, while
explicit config/table/offset/limit arguments remain supported.

The distribution launcher audit found three automatic local-backend openers:
HugeGraphServer, InitStore, and StoreDumper. All three now use the helper. ConfDumper,
CheckSocket, and Gremlin Console do not automatically open a local RocksDB graph, so no
unrelated preload was added.

The native smoke now stops the Server, runs the no-argument bin/dump-store.sh with a
120-second bound, and requires both current-run vertex IDs in the dump before restarting
and verifying persistence. On native RISC-V with Dragonwell 11, the current head passed
the clean 16-project build and the complete JNI/init/REST/Gremlin/store-dump/restart
flow with final process, PID, and port cleanup. The six Apache workflow suites for this
head were automatically scheduled and are currently awaiting maintainer approval.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: yes. Summary: The implementation is internally consistent, but the documented glibc 2.30 validation floor is not exercised by the glibc 2.39 CI environment. Evidence: exact-head workflow and README inspection; shell syntax and workflow static validation.

Comment thread hugegraph-server/README.md Outdated

## RISC-V Development and Testing

The RISC-V validation target is 64-bit `linux/riscv64` LP64D with glibc 2.30 or newer,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This calls glibc 2.30 the validation target, but the pinned Ubuntu 24.04 RISC-V environment uses glibc 2.39; the PR's own residual-risk note says 2.30 is inferred only from the RocksDB JNI ELF requirements. Dragonwell or another transitive native library can still require newer symbols, so users may read an untested compatibility floor as validated support. Please either run the runtime gate on glibc 2.30 or distinguish the inferred RocksDB JNI minimum from the fully validated glibc 2.39 environment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 87ec3519. The README now identifies Ubuntu 24.04 with glibc 2.39 as the end-to-end validated environment and explicitly limits GLIBC_2.30 to an inferred requirement of the packaged rocksdbjni:8.10.2 RISC-V ELF, not a validated compatibility floor for the complete HugeGraph, Dragonwell, and system-library runtime.

Current-head org Server CI, including the native RISC-V build and runtime smoke, passed: https://github.com/hugegraph/hugegraph/actions/runs/30093815746/job/89482983932. Apache exact-head workflows are awaiting maintainer approval.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Score: 9.2/10. The RISC-V support is well isolated from existing architectures, preserves the default build and distribution, and provides strong native build/runtime coverage including RocksDB JNI, StoreDumper, restart, and persistence.

No blocking code issues remain. The current Apache RISC-V check failed only because Maven Central returned a truncated jcseg-core download; merge after a clean CI rerun.
image

@github-project-automation github-project-automation Bot moved this from In progress to In review in HugeGraph PD-Store Tasks Jul 24, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 24, 2026
@imbajin imbajin changed the title feat(server): support RocksDB on RISC-V feat(server): support build & use(RocksDB) on RISC-V Jul 25, 2026
@imbajin
imbajin merged commit c10779d into apache:master Jul 25, 2026
22 of 24 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in HugeGraph PD-Store Tasks Jul 25, 2026
@imbajin imbajin linked an issue Jul 25, 2026 that may be closed by this pull request
9 tasks
bitflicker64 added a commit to bitflicker64/hugegraph that referenced this pull request Jul 26, 2026
- Localize read_property variables (match PD/Store)
- Use if ! download / if ! tar in ensure_package_exist so atomic
  download failures are detected without a fragile $? check

Also merges upstream master so the branch is no longer diverged
(RISC-V libatomic + CI from apache#3102 kept intact with check_port).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-cd Build or deploy feature New feature lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files. store Store module

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Task] Support HugeGraph with RocksDB on RISC-V

2 participants